package net.lab1024.sa.admin.module.business.yct.yctTeeth.controller;

import net.lab1024.sa.admin.module.business.yct.yctTeeth.domain.form.TemplatelogAddForm;
import net.lab1024.sa.admin.module.business.yct.yctTeeth.domain.form.TemplatelogQueryForm;
import net.lab1024.sa.admin.module.business.yct.yctTeeth.domain.form.TemplatelogUpdateForm;
import net.lab1024.sa.admin.module.business.yct.yctTeeth.domain.vo.TemplatelogVO;
import net.lab1024.sa.admin.module.business.yct.yctTeeth.service.TemplatelogService;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import cn.dev33.satoken.annotation.SaCheckPermission;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 模板消息发送日志 Controller
 *
 * @Author zhangben
 * @Date 2024-12-26 09:36:53
 * @Copyright 20241226
 */

@RestController
@Tag(name = "模板消息发送日志")
public class TemplatelogController {

    @Resource
    private TemplatelogService templatelogService;

    @Operation(summary = "分页查询 @author zhangben")
    @PostMapping("/templatelog/queryPage")
    @SaCheckPermission("templatelog:query")
    public ResponseDTO<PageResult<TemplatelogVO>> queryPage(@RequestBody @Valid TemplatelogQueryForm queryForm) {
        return ResponseDTO.ok(templatelogService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author zhangben")
    @PostMapping("/templatelog/add")
    @SaCheckPermission("templatelog:add")
    public ResponseDTO<String> add(@RequestBody @Valid TemplatelogAddForm addForm) {
        return templatelogService.add(addForm);
    }

    @Operation(summary = "更新 @author zhangben")
    @PostMapping("/templatelog/update")
    @SaCheckPermission("templatelog:update")
    public ResponseDTO<String> update(@RequestBody @Valid TemplatelogUpdateForm updateForm) {
        return templatelogService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author zhangben")
    @PostMapping("/templatelog/batchDelete")
    @SaCheckPermission("templatelog:delete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Integer> idList) {
        return templatelogService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author zhangben")
    @GetMapping("/templatelog/delete/{massageId}")
    @SaCheckPermission("templatelog:delete")
    public ResponseDTO<String> batchDelete(@PathVariable Integer massageId) {
        return templatelogService.delete(massageId);
    }
}
